package test.socket.obj;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;

public class Client {
	
	public static void main(String[] args) {
		Socket s = new Socket();
		try {
			s.connect(new InetSocketAddress("127.0.0.1", 6666));
			OutputStream os = s.getOutputStream();
			ObjectOutputStream oos = new ObjectOutputStream(os);
			oos.writeUTF("hello");
			oos.writeObject(new User("zhangsan", 19));
			oos.writeObject(new User("lisi", 43));
			s.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
